package com.foreknow.demo5;

/**
 * 构造器就是一个特殊的方法
 */
public class ConstrctorDemo1 {
    private String name;
    private int age;
    private String[] strs;
    private Employee emp;

    //通过构造器来初始化属性
    public ConstrctorDemo1(String name,int age) {
       this.name = name;
       this.age = age;
       strs = new String[10];
       emp = new Employee();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }


    public static void main(String[] args) {
        ConstrctorDemo1 c = new ConstrctorDemo1("fender",30);
        System.out.println(c.getName());
        System.out.println(c.getAge());
    }
}
